package com.example.feed.multichannel;

import java.util.ArrayList;
import java.util.List;

public class ChannelModel {
    private static final String[] CHANNEL_NAMES = new String[]{
            "推荐", "抗疫", "本地", "搞笑", "军事", "懂车帝", "故事", "新热"
    };
    List<ChannelInfo> mChannels = new ArrayList<>();

    private void checkAndInit() {
        if (mChannels.isEmpty()) {
            for (int i = 0; i < CHANNEL_NAMES.length; i++) {
                ChannelInfo channelInfo = new ChannelInfo();
                channelInfo.channelId = "id_" + i;
                channelInfo.title = CHANNEL_NAMES[i];
                mChannels.add(channelInfo);
            }

        }
    }

    public void readChanel(Callback callback) {
        checkAndInit();
        callback.onResult(true, mChannels);
    }

    public interface Callback {
        void onResult(boolean success, List<ChannelInfo> list);
    }

}
